<?php  
include("common/db.php");
include("common/page.php");
if($_SESSION['userid']==""){
  echo "<script>window.location.href='login.php';</script>";
}
// 分页
if ($_REQUEST[act]==0) {
  $sql="select count(*) from cash_flow where shopid=".$_REQUEST[shopid]." and addtime<'".$_REQUEST[latedate]."' and addtime>'".$$_REQUEST[date]."'";
}else{
  $sql="select count(*) from cash_flow where shopid=".$_REQUEST[shopid]."";
}
$totalNum=$mysql->getOne($sql);
$pagesize=10;
$pageTool=new PageTool($totalNum,$pagesize);
if (!isset($_REQUEST['page'])) {
  $de=0;
}else{
  $de=($_REQUEST['page']-1)*$pagesize;
}
// 分页 end
//查找商家的现金流量
if ($_REQUEST[act]==0) {
//查找商家的一天现金流量
  $sql="select * from cash_flow where shopid=".$_REQUEST[shopid]." and addtime<'".$_REQUEST[latedate]."' and addtime>'".$_REQUEST[date]."' order by addtime desc limit ".$de.",".$pagesize."";
  $cash_flow=$mysql->getAll($sql);
//查找商家的一天现金流量 end
}else{
// 查找商家的历史现金流量
  $sql="select * from cash_flow where shopid=".$_REQUEST[shopid]." order by addtime desc limit ".$de.",".$pagesize."";
  $cash_flow=$mysql->getAll($sql);
// 查找商家的历史现金流量
}
// 查找商家的现金流量 end

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>e网批发管理后台</title>
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <link href="css/styles.css" rel="stylesheet" type="text/css" />
  <link href="css/style2.css" rel="stylesheet" type="text/css" />
  <link rel="stylesheet" type="text/css" href="css/brokerage.css">
  <script type="text/javascript" src="js/jquery.tipsy.js"></script>
  <script type="text/javascript" src="js/scripts.js"></script>	
</head>

<body>

  <!--header-->
  <?php include("common/header.php");?>
  <!--header end-->


  <!-- staqrt subnav -->
  <div id="sub_nav">

    <div id="subnav_wrap" class="container_12">

      <!-- start sub nav list -->
      <div id="subnav" class=" grid_12">

        <ul>
          <li><a href="shequ.php" >商家管理</a></li>
          <li><a href="brokerage.php" class="sub_nav_active" >佣金管理</a></li>
        </ul>

      </div>

    </div>


  </div>

  <div class="container_12">

    <table width="100%" border="0" cellpadding="0" cellspacing="0">



      <tr>
        <th width="20%" scope="col">打款时间</th>
        <th width="20%" scope="col">事件</th>
        <th width="20%" scope="col">资金变化</th>
      </tr>

      <?php foreach ($cash_flow as $k=>$v) { ?>
      <tr>

        <td scope="col"><?php echo $v[addtime];?></td>
        <td scope="col"><?php echo $v[content];?></td>
        <td scope="col"><?php echo $v[amount];?>元</td>
      </tr>
      <?php } ?>		
    </table>
    <!-- 分页 -->
    <div style="clear:both;margin-top:4em;text-align:center;">
      <?php echo $pageTool->show(); ?>
    </div>
    <!-- 分页 end -->
  </body>

  </html>
